package cn.itcast.mq.config;


import org.springframework.amqp.core.*;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;


@Configuration
public class FanoutConfig {
    @Bean
    public FanoutExchange fanoutExchange(){
        return new FanoutExchange("itcast.fanout");
    }
    @Bean
    Queue fanoutQueue1(){
        return new Queue("fanout.queue1");
    }
    @Bean
    Queue fanoutQueue2(){
        return new Queue("fanout.queue2");
    }
    @Bean
    Binding bindingQueue1(){
        return BindingBuilder.bind(fanoutQueue1()).to(fanoutExchange());
    }
    @Bean
    Binding bingingQueue2(){
        return  BindingBuilder.bind(fanoutQueue2()).to(fanoutExchange());
    }



//    @Bean
//    DirectExchange directExchange(){
//        return new DirectExchange("itcast.direct1");
//
//    }
//    @Bean
//    Queue directQueue1(){
//        return new Queue("direct1.queue1");
//    }
//    @Bean
//    Queue directQueue2(){
//        return new Queue("direct1.queue2");
//    }
//    @Bean
//    Binding bindingQueue3(){
//      return BindingBuilder.bind(directQueue1()).to(directExchange());
//    }
//    @Bean
//    Binding bindingQueue4(Queue directQueue2,DirectExchange directExchange){
//        return BindingBuilder.bind(directQueue2()).to(directExchange());
//
}
